package slap.mvc;

import java.util.concurrent.Future;

import slap.http.Request;
import slap.http.websocket.Inbound;
import slap.http.websocket.Outbound;
import slap.http.websocket.WebSocketFrame;
import slap.mvc.result.WebSocketDisconnect;
import slap.paradigm.Procedure;
import slap.paradigm.Procedure.Procedure1;
import slap.paradigm.ProcedureV;

public class WebSocketHandler extends Controller {

	public void onOpen() {

	}

	public void onClose() {

	}

	public void onMessage(WebSocketFrame frame) {

	}

	protected void await(String timeout) {
		HttpRequestController.await(timeout);
	}

	protected void await(String timeout, ProcedureV callback) {
		HttpRequestController.await(timeout, callback);
	}

	protected void await(int millis) {
		HttpRequestController.await(millis);
	}

	protected void await(int millis, ProcedureV callback) {
		HttpRequestController.await(millis, callback);
	}

	protected <T> T await(Future<T> future) {
		return HttpRequestController.await(future);
	}

	protected <T> void await(Future<T> future, Procedure1<T> callback) {
		HttpRequestController.await(future, callback);
	}

	protected void disconnect() {
		throw new WebSocketDisconnect();
	}

}
